'''
Created on 2010-10-18

@author: DouglasWin7
'''
from google.appengine.ext import db
from accessor.distinction import distinction

class distinctiondetail(db.Model):
    name = db.StringProperty()
    point = db.IntegerProperty()
    description = db.StringProperty()
    
    '''
    Add Distinction
    '''
    @staticmethod
    def add_distinctiondetail(name,point,description):
        dist = distinctiondetail(name=name,point=point,description=description)
        distinction.add_point(name, point)
        dist.put()
    
    @staticmethod
    def get_distinctiondetail(name):
        query = db.GqlQuery("SELECT * FROM distinctiondetail WHERE name=:1",name)
        return query.fetch(100)
        
    @staticmethod
    def delete_distinction(name):
        result = distinction.get_point(name)
        if result!= None :
            db.delete(result)
            db.delete(distinctiondetail.get_distinctiondetail(name))